package com.xuxin.baby.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.xuxin.baby.R;
import com.xuxin.baby.glide.GlideApp;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xu_xin
 * Created on 2020/11/13 0013
 * 儿童保健扩展
 */
public class HealthAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public HealthAdapter() {
        super(R.layout.item_health);
        List<String> list = new ArrayList<>();
        list.add("生长发育");
        list.add("便便");
        setList(list);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, String item) {
        ImageView item_health_image = holder.getView(R.id.item_health_image);
        holder.setText(R.id.item_health_name, item);
        switch (holder.getAdapterPosition()) {
            case 0:
                GlideApp.with(getContext()).load(R.mipmap.img_health_growth).placeholder(R.mipmap.img_placeholder160).centerCrop().into(item_health_image);
                break;
            case 1:
                GlideApp.with(getContext()).load(R.mipmap.img_health_excretion).placeholder(R.mipmap.img_placeholder160).centerCrop().into(item_health_image);
                break;
        }
    }
}